package com.chuang.bootplus.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.chuang.bootplus.base.constant.Constant;
import com.chuang.bootplus.base.utils.ApiResponse;
import com.chuang.bootplus.entity.Picture;
import com.chuang.bootplus.service.PictureService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-08-28
 */
@RestController
@RequestMapping("/picture")
@Api(tags = "图片")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PictureController {

    final PictureService pictureService;


    @PostMapping("/getIndexPicture")
    @ApiOperation("获取轮播图")
    public ApiResponse<Picture> getIndexPicture(){
        List<Picture> pictureList = pictureService.list(
                new LambdaQueryWrapper<Picture>()
                        .eq(Picture::getTypeName, Constant.PICTURE_TYPE_INDEX));
        return new ApiResponse<>(pictureList);
    }
}

